{include file="admin/top.php" subject='purchases'}
{include file="purchases/top.php" subject='purchases'}
<div id="content">
{rights right='purchases_create'}<ul id="addmenu"><li style="display: inline;"><a href="{$site_admin}m=inventory&s=purchases.php&uri=create">添加采购</a></li><li style="display: inline;padding-left:10px;"><a href="{$site_admin}m=inventory&s=purchases.php&uri=orderProducts">待采购商品</a></li></ul>{/rights}
    <div id="boxquery">
    <form method="get">
    <input type="hidden" name="m" value="inventory" />
        <input type="hidden" name="s" value="purchases.php" />
        <input type="submit" value="查询" class="fr" />
        <li>仓库:&nbsp; <select id="shopid" name="shopid"><option value="">全部</option>{shops}<option value="{$shops.id}" {if $shops.id==$smarty.get.shopid}selected{/if}>{$shops.title}</option>{/shops}</select></li>
        <li>采购单ID:&nbsp;<input type="text" name="paper_id" value="{$smarty.get.paper_id}" /></li>
        <li>采购单名称:&nbsp;<input type="text" name="paper_title" value="{$smarty.get.paper_title}" /></li>
        <li class="yui-skin-sam">添加时间:&nbsp; 
            <input id="sdate" name="sdate" type="text" size="12" value="{$smarty.get.sdate}" onfocus="lockinput(this)" />
            <input id="edate" name="edate" type="text" size="12" value="{$smarty.get.edate|default:$smarty.now|date_format:'%Y-%m-%d'}" onfocus="lockinput(this)" />
            <div id="calContainer" style="display:none; position:absolute;"></div>
        </li>
        <li>供应商:&nbsp;
        <input name="supplier" type="text" id="supplier" value="{$smarty.get.supplier}" size="16" onclick="select()" oninput="context_menu_suppliers(this, 'supplierid=[id],supplier=[title]')" onfocus="context_menu_suppliers(this, 'supplierid=[id],supplier=[title]')" />
        </li>
        <li>状态:&nbsp; <select id="status" name="status"><option value="" >全部</option><option value="0" {if "0"===$smarty.get.status}selected{/if}>未入库</option><option value="1" {if "1"===$smarty.get.status}selected{/if}>已入库</option><option value="-1" {if "-1"===$smarty.get.status}selected{/if}>已删除</option></select></li>
    </form>
    </div>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="lister">
      <tr id="title">
        <td width="40">ID</td>
        <td>名称</td>
        <td>仓库</td>
        <td>供应商</td>
        <td>备注</td>
        <td>运费</td>
        <td>折扣</td>
        <td>其他费用</td>
        <td>采购总价</td>
        <td>货币单位</td>
        <td>填单人</td>
        <td>填单时间</td>
        <td>状态</td>
        <td></td>
      </tr>
      {purchases limit=20 pager=pager page=$segment.page order="create_time desc" shopid=$smarty.get.shopid sdate=$smarty.get.sdate edate=$smarty.get.edate  supplier=$smarty.get.supplier status=$smarty.get.status paper_id=$smarty.get.paper_id paper_title=$smarty.get.paper_title}
      <tr id="content">
        <td>{$purchases.id}</td>
        <td>{$purchases.title}</td>
        <td>{$purchases.shop}</td>
        <td>{$purchases.supplier_name}</td>
        <td style="word-wrap:break-word; word-break:break-all;max-width:100px;">{$purchases.memo}</td>
        <td>{$purchases.express_price*1}</td>
        <td>{$purchases.discount_price*1}</td>
        <td>{$purchases.other_price*1}</td>
        <td>{$purchases.purchase_price*1}</td>
        <td>{$purchases.currency_unit}</td>
        <td>{$purchases.puser}</td>
        <td>{$purchases.create_time}</td>
		<td>
			{if $purchases.status=='-1'}已删除{/if}
			{if $purchases.status=='0'}未审核{/if}
			{if $purchases.status=='1'}已审核{/if}
			{if $purchases.status=='2'}已确认{/if}
			{if $purchases.status=='9'}已入库{/if}
		</td>
        <td align="right">
        {if $purchases.status=='0'}
        <a href="{$site_admin}m=inventory&s=purchases.php&purchases_id={$purchases.id}&uri=audit" onclick="return confirm('审核通过后将不能再删除, 确定?')">审核</a>
<!--         {rights right='purchases_remove'}<a href="{$site_admin}m=inventory&s=purchases.php&purchases_id={$purchases.id}&uri=remove" onclick="return confirm('删除数据不可恢复, 确定删除?')">删除</a>{/rights} -->
        {rights right='purchases_modify'}<a href="{$site_admin}m=inventory&s=purchases.php&purchases_id={$purchases.id}&uri=modify">编辑</a>{/rights}
        {/if}
        {if $purchases.status=='1'}
        <a href="{$site_admin}m=inventory&s=purchases.php&purchases_id={$purchases.id}&uri=confirm" onclick="return confirm('确认通过后将不能再编辑, 确定?')">确认</a>
<!--         {rights right='purchases_remove'}<a href="{$site_admin}m=inventory&s=purchases.php&purchases_id={$purchases.id}&uri=remove" onclick="return confirm('删除数据不可恢复, 确定删除?')">删除</a>{/rights} -->
        {rights right='purchases_modify'}<a href="{$site_admin}m=inventory&s=purchases.php&purchases_id={$purchases.id}&uri=modify">编辑</a>{/rights}
        {/if}
        <a id="purchases_{$purchases.id}" href="javascript:void(0);" onclick="show_sku_list({$purchases.id});" act="show">查看</a>
        <a href="javascript:void(0);" onclick="javascript:window.parent.iframe_form('sendprint', '采购单打印', '/admin/module.php?m=logistics&s=print.php&type=purchasePrint&purchaseid={$purchases.id}', 850,500);" act="show">打印</a>
        </td>
      </tr>
      {/purchases}
      {if $pager->rows==0}
      <tr id="content">
        <td colspan="20">&nbsp;</td>
      </tr>
      {/if}
    </table>
    <div id="pager" class="mt10">
        {if $pager}共{$pager->rows}条记录 第{$pager->pagecurrent}/{$pager->pages}页 {/if} 		
        {if $pager->current > 1}<a href="{url s1=1}">首页</a>{/if}
        {if $pager->current > 1}<a href="{url s1=$pager->current-1}">上页</a>{/if}
        {if $pager->current < $pager->pages}<a href="{url s1=$pager->current+1}">下页</a>{/if}
        {if $pager->current < $pager->pages}<a href="{url s1=$pager->pages}">尾页</a>{/if}
	</div>
</div>
{include file="admin/bottom.php"}
</body>
</html>
